import {reqAddressInfo,reqTrade} from '@/api'

const state = {
    addressInfo:[],
    orderInfo:{}
}
const mutations = {
    GETUSER(state,address){
        state.addressInfo = address

    },
    GETORDER(state,order){
        state.orderInfo = order
    }
}
const actions = {
    // 获得用户地址
    async getUserAddress({commit}){
        let result = await reqAddressInfo()
        if(result.code == 200){
            commit('GETUSER',result.data)
        }
    },

    // 获取订单交易页信息
    async getOrderInfo({commit}){
        let result = await reqTrade()
        if(result.code == 200){
            commit('GETORDER',result.data)
        }
    }
    
}
const getters = {
}

export default {
    namespaced:true,
    state,
    mutations,
    actions,
    getters
}

